<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>北京亚康万玮信息技术股份有限公司</title>
    <link rel="stylesheet" href="plugins/layui/css/layui.css">
    <css>

    </css>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">北京亚康万玮有限公司</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">报表</a></li>
            <!--<li class="layui-nav-item"><a href="">商品管理</a></li>-->
            <!--<li class="layui-nav-item"><a href="">用户</a></li>-->
            <li class="layui-nav-item">
                <a href="javascript:;">其它</a>
                <dl class="layui-nav-child">
                    <dd><a href="">xxx</a></dd>
                    <dd><a href="">xxx</a></dd>
                    <dd><a href="">xxx</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    XXXX
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退了</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">财务报表</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:projectDurationWagesSummary();">项目总工时和总成本</a></dd>
                        <dd><a href="javascript:userDurationWagesDetail();">项目人员工时和工资成本</a></dd>
                        <dd><a href="javascript:projectOtherCostSummary();">项目费用成本</a></dd>
                        <dd><a href="javascript:projectCostSummary();">项目总成本</a></dd>
                    </dl>
                </li>
                <!--<li class="layui-nav-item">-->
                    <!--<a href="javascript:;">解决方案</a>-->
                    <!--<dl class="layui-nav-child">-->
                        <!--<dd><a href="javascript:;">列表一</a></dd>-->
                        <!--<dd><a href="javascript:;">列表二</a></dd>-->
                        <!--<dd><a href="">超链接</a></dd>-->
                    <!--</dl>-->
                <!--</li>-->
                <!--<li class="layui-nav-item"><a href="">云市场</a></li>-->
                <!--<li class="layui-nav-item"><a href="">发布商品</a></li>-->
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <span id="company_name">北京亚康万玮信息技术股份有限公司</span>
        <table class="layui-table" style="display: none">
            <thead>
                <tr>
                    <th>项目编号</th>
                    <th>姓名</th>
                    <th>人员总工时</th>
                    <th>人员成本（薪资万元）</th>
                    <th>项目总工时</th>
                    <th>项目总成本（薪资）</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script src="plugins/layui/layui.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>

<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;
    });
    function projectDurationWagesSummary(){
        $("#company_name").hide();
        $("table").empty();
        $("table").show();
        $("table").append(
            "<thead>" +
            "    <tr>" +
            "    <th>项目编号</th>" +
            "    <th>总工时(小时)</th>" +
            "    <th>项目总成本【薪资成本万元】</th>" +
            "    </tr>" +
            "</thead>" +
            "<tbody>" +
            "</tbody>"
        )
        var tb=$("tbody")
        $.ajax({
            type: 'POST',
            url: '/report/projectDurationWagesSummary.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result&&result.success){
                    $.each(result.data,function (i,o) {
                        tb.append(
                            "<tr>" +
                            "   <td>"+o.projectId+"</td>" +
                            "   <td>"+o.durationTotal+"</td>" +
                            "   <td>"+o.wagesTotal+"</td>" +
                            "</tr>");

                    });
                }
            }
        })
    }
    function userDurationWagesDetail(){
        $("#company_name").hide();
        $("table").empty();
        $("table").show();
        $("table").append(
            "<thead>" +
            "    <tr>" +
            "    <th>项目编号</th>" +
            "    <th>姓名</th>" +
            "    <th>人员总工时</th>" +
            "    <th>人员成本（薪资万元）</th>" +
            "    <th>项目总工时</th>" +
            "    <th>项目总成本（薪资）</th>" +
            "    </tr>" +
            "</thead>" +
            "<tbody>" +
            "</tbody>"
        )
        var tb=$("tbody")
        $.ajax({
            type: 'POST',
            url: '/report/userDurationWagesDetail.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result&&result.success){
                    $.each(result.data,function (i,o) {
                        tb.append(
                            "<tr>" +
                            "   <td rowspan=\""+o.size+"\" valign=\"top\">"+o.projectId+"</td>" +
                            "   <td>"+o.frist.userName+"</td>" +
                            "   <td>"+o.frist.workDuration+"</td>" +
                            "   <td>"+o.frist.cost+"</td>" +
                            "   <td rowspan=\""+o.size+"\" valign=\"top\">"+o.durationTotal+"</td>" +
                            "   <td rowspan=\""+o.size+"\" valign=\"top\">"+o.wagesTotal+"</td>" +
                            "</tr>");
                        $.each(o.infos,function (ii,oo) {
                            tb.append(
                                "<tr>" +
                                "   <td>"+oo.userName+"</td>" +
                                "   <td>"+oo.workDuration+"</td>" +
                                "   <td>"+oo.cost+"</td>" +
                                "</tr>");
                        })
                    });
                }
            }
        })
    }
    function projectOtherCostSummary() {
        $("#company_name").hide();
        $("table").empty();
        $("table").show();
        $("table").append(
            "<thead>" +
            "    <tr>" +
            "    <th>项目编号</th>" +
            "    <th>费用类型</th>" +
            "    <th>费用金额（万元）</th>" +
            "    <th>费用汇总（万元）</th>" +
            "    </tr>" +
            "</thead>" +
            "<tbody>" +
            "</tbody>"
        )
        var tb=$("tbody")
        $.ajax({
            type: 'POST',
            url: '/report/projectOtherCostSummary.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result&&result.success){
                    $.each(result.data,function (i,o) {
                        tb.append(
                            "<tr>" +
                            "   <td rowspan=\"2\">"+o.projectId+"</td>" +
                            "   <td>房租</td>" +
                            "   <td>"+o.rentTotal+"</td>" +
                            "   <td rowspan=\"2\">"+o.total+"</td>" +
                            "</tr>"+
                            "<tr>" +
                            "   <td>费用</td>" +
                            "   <td>"+o.costTotal+"</td>" +
                            "</tr>");
                    });
                }
            }
        })
    }
    function projectCostSummary() {
        $("#company_name").hide();
        $("table").empty();
        $("table").show();
        $("table").append(
            "<thead>" +
            "    <tr>" +
            "    <th>项目编号</th>" +
            "    <th>新资成本</th>" +
            "    <th>非用成本</th>" +
            "    <th>项目总成本</th>" +
            "    </tr>" +
            "</thead>" +
            "<tbody>" +
            "</tbody>"
        )
        var tb=$("tbody")
        $.ajax({
            type: 'POST',
            url: '/report/projectCostSummary.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result&&result.success){
                    $.each(result.data,function (i,o) {
                        tb.append(
                            "<tr>" +
                            "   <td>"+o.projectId+"</td>" +
                            "   <td>"+o.wagesTotal+"</td>" +
                            "   <td>"+o.otherTotal+"</td>" +
                            "   <td>"+o.total+"</td>" +
                            "</tr>");
                    });
                }
            }
        })
    }

</script>
</body>
</html>